function reverse( str ) {
  const s = str;
  const n = s.length;
  const stack = [];
  let i = n;
  for(i=n;i--;i<0) {
    if (s[i] === ')' || s[i] === '(') {
      continue;
    } else {
      stack.push(s[i])
    }
  }
  return stack.join("")
}